mod log;

use anyhow::Result;
use std::{thread, time::Duration};
use tracing::{debug, error, instrument};

fn main() -> Result<()> {
    let _guard = log::init("./log", "example.log", "config/log_filter.txt")?;

    thread::spawn(foo);
    loop_log();
    Ok(())
}

fn loop_log() {
    for i in 0.. {
        error!(i, "Hello, error!");
        debug!(i, "Hello, debug!");
        thread::sleep(Duration::from_secs(1));
    }
}

#[instrument]
fn foo() {
    loop_log()
}
